package org.diylc.netlist;

import org.junit.Test;

import org.diylc.components.electromechanical.RotarySwitchOpen;
import org.diylc.components.electromechanical.RotarySwitchOpenType;

public class RotarySwitchOpenTests extends AbstractSwitchTests {

  @Test
  public void testRotarySwitch2P5T() {
    RotarySwitchOpen sw = new RotarySwitchOpen();

    String[] validCombinations = new String[] {
        "0,5,11", "0,10,12", 
        "1,4,11", "1,9,12", 
        "2,3,11", "2,8,12", 
        "3,2,11", "3,7,12", 
        "4,1,11", "4,6,12"};

    sw.setValue(RotarySwitchOpenType._2P5T);
    testSwitch(sw, validCombinations);
  }
  
  @Test
  public void testRotarySwitch2P6T() {
    RotarySwitchOpen sw = new RotarySwitchOpen();

    String[] validCombinations = new String[] {
        "0,6,13", "0,12,14", 
        "1,5,13", "1,11,14", 
        "2,4,13", "2,10,14", 
        "3,3,13", "3,9,14", 
        "4,2,13", "4,8,14", 
        "5,1,13", "5,7,14"};

    sw.setValue(RotarySwitchOpenType._2P6T);
    testSwitch(sw, validCombinations);
  }
  
  @Test
  public void testRotarySwitch4P5T() {
    RotarySwitchOpen sw = new RotarySwitchOpen();

    String[] validCombinations = new String[] {
        "0,5,11", "0,10,12", "0,17,23", "0,22,24", 
        "1,4,11", "1,9,12", "1,16,23", "1,21,24",  
        "2,3,11", "2,8,12", "2,15,23", "2,20,24", 
        "3,2,11", "3,7,12", "3,14,23", "3,19,24", 
        "4,1,11", "4,6,12", "4,13,23", "4,18,24"};

    sw.setValue(RotarySwitchOpenType._4P5T);
    testSwitch(sw, validCombinations);
  }
  
  @Test
  public void testRotarySwitch4P6T() {
    RotarySwitchOpen sw = new RotarySwitchOpen();

    String[] validCombinations = new String[] {
        "0,6,13", "0,12,14", "0,20,27", "0,26,28",
        "1,5,13", "1,11,14", "1,19,27", "1,25,28", 
        "2,4,13", "2,10,14", "2,18,27", "2,24,28",
        "3,3,13", "3,9,14", "3,17,27", "3,23,28",
        "4,2,13", "4,8,14", "4,16,27", "4,22,28",
        "5,1,13", "5,7,14", "5,15,27", "5,21,28",};

    sw.setValue(RotarySwitchOpenType._4P6T);
    testSwitch(sw, validCombinations);
  }
}
